let s = Symbol();
// console.log(typeof s)
var s1 = Symbol("foo");
var s2 = Symbol("bar");
/*

console.log(s1 == s2)
console.log(s1.toString())
console.log(s2.toString())
*/

let obj = {
    toString() {
        return "abc"
    }
}

let s3 = Symbol(obj)
console.log(s3)

let s5 = Symbol("foo");
let s6 = Symbol("foo");
/*console.log(s5 === s6)
console.log("str " + s5)*/
console.log(s5.description);


let mySymbol = Symbol();

let obj1 = {}
let obj3 = {}
obj1[mySymbol] = 666;
let obj2 = {
    [mySymbol]: 667
}

Object.defineProperty(obj3, mySymbol, {value: 668})

console.log(obj1)
console.log(obj2)
console.log(obj3)


let obj4 = {
    [mySymbol](args) {

    }
}


const log = {}
log.level = {
    DEBUG: Symbol("debug"), INFO: Symbol("info"), WARN: Symbol("warn")
}
// console.log(log.level.DEBUG,':debug message')


const COLOR_RED = Symbol("red");
const COLOR_GREEN = Symbol("green");


function getComplement(color) {
    switch (color) {
        case COLOR_RED:
            return COLOR_GREEN;
        case COLOR_GREEN:
            return COLOR_RED
        default:
            throw new Error("未定义的错误")


    }
}

// console.log(getComplement("COLOR_GREEN"));

/*Object.getOwnPropertySymbols(obj1).forEach(key => console.log(obj1[key]))
Reflect.ownKeys(obj1).forEach(console.log)*/


var s11 = Symbol("foo");
var s12 = Symbol.for("foo");
console.log(s11 == s12)
var s4 = Symbol.keyFor(s11);
console.log(s4)
